package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/3/6 9:47
 * @since v1.0
 */
@Getter
public enum ListOptionTabEnum {
    EDIT("option_edit","enum.listOptionTab.attrName.edit"),


    DEL("option_del","enum.listOptionTab.attrName.del"),


    VIEW("option_view","enum.listOptionTab.attrName.view"),


    GRAB("option_grab","enum.listOptionTab.attrName.grab"),


    RESTART("option_restart","enum.listOptionTab.attrName.restart"),


    FINISH("option_finish","enum.listOptionTab.attrName.finish"),


    ADDPAYMENT("option_add_payment","enum.listOptionTab.attrName.addpayment"),

    PAYMENT_WRITE_OFF("option_payment_write_off","enum.listOptionTab.attrName.payment_write_off"),

    ADDINVOICE("option_add_invoice","enum.listOptionTab.attrName.addinvoice"),


    ADDPAYPLAN("option_add_payplan","enum.listOptionTab.attrName.addpayplan"),

    ADDPURCHASEINVOICE("option_add_purchase_invoice","enum.listOptionTab.attrName.addpurchaseinvoice"),

    CANCEL("option_cancel","enum.listOptionTab.attrName.cancel"),

    PURCHASE_INVOICE_CANCEL("option_invoice_invoice_cancel","enum.listOptionTab.attrName.purchase_invoice_cancel"),

    RED("option_red","enum.listOptionTab.attrName.red"),

    PURCHASE_INVOICE_RED("option_red","enum.listOptionTab.attrName.purchase_invoice_red"),

    PURCHASE("option_purchase","enum.listOptionTab.attrName.purchase"),


    PRODUCE("option_produce","enum.listOptionTab.attrName.produce"),


    INSTOCK("option_instock","enum.listOptionTab.attrName.instock"),


    OUTSTOCK("option_outstock","enum.listOptionTab.attrName.outstock"),


    ONLINE("option_online","enum.listOptionTab.attrName.online"),


    OFFLINE("option_offline","enum.listOptionTab.attrName.offline"),

    /**
     * 信用管理
     */
    CREDIT_FREEZE("credit_freeze", "enum.listOptionTab.attrName.credit_freeze"),
    CREDIT_UNFREEZE("credit_unfreeze", "enum.listOptionTab.attrName.credit_unfreeze"),
    CREDIT_REVOKE("credit_revoke", "enum.listOptionTab.attrName.credit_revoke"),
    CREDIT_NORMAL("credit_normal", "enum.listOptionTab.attrName.credit_normal"),

    /**
     * 对账单
     */
    REMIND_CONFIRM_STATEMENT("remindConfirm", "enum.listOptionTab.attrName.remind_confirm_statement"),
    VALET_CONFIRM_STATEMENT("valetConfirm", "enum.listOptionTab.attrName.valet_confirm_statement"),
    REGENERATE_STATEMENT("regenerate", "enum.listOptionTab.attrName.regenerate_statement"),
    CONFIRMED("confirmed", "enum.distributorButton.value.confirmed"),
    QUESTION_FEEDBACK("questionFeedback", "enum.distributorButton.value.question_feedback"),

    REVERT("option_revert","enum.listOptionTab.attrName.revert"),


    INVOICE_REVERT("option_invoice_revert","enum.listOptionTab.attrName.invoice_revert"),

    PURCHASE_INVOICE_REVERT("option_purchase_invoice_revert","enum.listOptionTab.attrName.purchase_invoice_revert"),

    COMPLETE_DEL("option_complete_del","enum.listOptionTab.attrName.complete_del"),


    OPTION_WRITE_OFF_PREPAYMENT("option_write_off_prepayment","enum.listOptionTab.attrName.option_write_off_prepayment"),

    OPTION_WRITE_OFF_PREPAY("option_write_off_prepay","enum.listOptionTab.attrName.option_write_off_prepay"),
    ADD("add","enum.listOptionTab.attrName.add"),
    IMPORT("import","enum.listOptionTab.attrName.import"),
    EXPORT("export",SaasButtonEnum.EXPORT.getValue()),
    TRACK("track", "enum.listOptionTab.attrName.track"),

    ENABLE("option_enable","enum.bomStatus.name.enable"),


    DISABLE("option_disable","enum.bomStatus.name.disable"),
    ;

    private String attr;
    private String attrName;

    ListOptionTabEnum(String attr, String attrName) {
        this.attr = attr;
        this.attrName = attrName;
    }

    public static ListOptionTabEnum getByAttr(String operate) {
        for (ListOptionTabEnum value : values()) {
            if (Objects.equals(value.getAttr(),operate)) {
                return value;
            }
        }
        return null;
    }

    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }
}
